
package model;


import java.awt.geom.Point2D;
import java.util.LinkedList;

import shape.ModelShape;
import view.View;


public class ModelImpl implements Model {

	private View					view;
	private LinkedList<ModelShape>	shapes;
	private ModelShape				currentShape;


	public ModelImpl() {
		super();
		this.shapes = new LinkedList<ModelShape>();
	}


	public void setView(View view) {
		this.view = view;
	}


	/**
	 * Métodos para el controlador
	 */
	public ModelShape selectShapeWithPoint(Point2D point) {
		for (ModelShape shape : shapes)
			if (shape.checkContains(point)) {
				currentShape = shape;
				return shape;
			}
		return null;
	}


	public void moveShapeToPoint(Point2D point) {
		if (currentShape != null)
			currentShape.moveTo(point);
	}
}
